﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace CMD_DKT
{
    public class AppConfs
    {
        public static string ServerDocsFolder
        {
            get
            {
                string tmp;
                try
                {
                    tmp = ConfigurationManager.AppSettings["ServerDocsFolder"].ToString();
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    tmp = @"C:\test\CMD\DOCS\Server\";
                }

                return tmp;
            }
        }//

        public static string ClientDocsFolder
        {
            get
            {
                string tmp;
                try
                {
                    tmp = ConfigurationManager.AppSettings["ClientDocsFolder"].ToString();
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    tmp = @"C:\test\CMD\DOCS\Client\";
                }

                return tmp;
            }
        }//

        public static int Status_Enviado
        {
            get {
                int tmp;
                try
                {
                    tmp = int.Parse(ConfigurationManager.AppSettings["Status_Enviado"].ToString());
                }
                catch (Exception ex)
                {
                    tmp = 0;
                }

                if (tmp == 0)
                {
                    tmp = 2;
                }

                return tmp;
            }
        }//

        public static int Status_proceso
        {
            get 
            {
                int tmp;

                try
                {
                    tmp = int.Parse(ConfigurationManager.AppSettings["Status_proceso"].ToString());
                }
                catch (Exception ex)
                {
                    tmp = 0;
                }

                if (tmp==0)
                {
                    tmp = 3;
                }
                return tmp;
            }
        
        }//

        public static string WCFService
        {
            get
            {
                string tmp;
                try
                {
                    tmp = ConfigurationManager.AppSettings["WCFService"].ToString();
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    tmp = @"http://192.168.0.114:8085/Services/Auth.svc/";
                }

                return tmp;
            }
        }//

        public static string ParamsNotIncludeGetSol
        {
            get
            {
                string tmp;
                try
                {
                    tmp = ConfigurationManager.AppSettings["NotIncludeGetSol"].ToString();
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    tmp = @"dirEnt_dscLocal,dirFis_dscLocal,datgral_dscTipoNeg,datsol_dscTipoSolicitante,datsol_dscTipoPersonaFiscal,dirFis_codPos,dirFis_est,dirFis_col,dirFis_mun,dirEnt_codPos,dirEnt_est,dirEnt_col,dirEnt_mun,datDPV_dscZona,datDPV_dscFrec,datBnc_dscBanc";
                }

                return tmp;
            }
        }//

        public static string UpdaterProcess
        {
            get
            {
                string tmp;
                try
                {
                    tmp = ConfigurationManager.AppSettings["UpdaterProcess"].ToString();
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    tmp = "WPFUpdater.exe";
                }

                return tmp;
            }
        }

        public static string CarpetaInstalacion 
        {
            get
            {
                string tmp;
                try
                {
                    tmp = ConfigurationManager.AppSettings["CarpetaInstalacion"].ToString();
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    tmp = @"C:\Programs\CMD\";
                }

                return tmp;
            }
        }

        public static TimeSpan tsTimer 
        {
            get
            {
                string h,m,s;
                TimeSpan ts;

                try
                {
                    h = ConfigurationManager.AppSettings["TimeSpan_H"].ToString();
                    m = ConfigurationManager.AppSettings["TimeSpan_M"].ToString();
                    s = ConfigurationManager.AppSettings["TimeSpan_S"].ToString();

                    ts = new TimeSpan(int.Parse(h),int.Parse(m),int.Parse(s));
                }
                catch (Exception ex)
                {
                    h=m=s = "";

                    ts = new TimeSpan(0, 0, 20);
                }

                //if (String.IsNullOrEmpty(h))
                //{
                //    ts = new TimeSpan(0, 0, 20);
                //}
                

                return ts;
            }
        }

        public static long Unid_datosMaestros
        {
            get 
            {
                string tmp;
                long dat = 0;
                try
                {
                   tmp= ConfigurationManager.AppSettings["Unid_datosMaestros"].ToString();
                   dat = long.Parse(tmp);
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    dat = 20120000000000000;
                }
                return dat;
            }
        }

        public static long Unid_CreditoYCobranza
        {
            get
            {
                string tmp;
                long dat = 0;
                try
                {
                    tmp = ConfigurationManager.AppSettings["Unid_CreditoYCobranza"].ToString();
                    dat = long.Parse(tmp);
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    dat = 20120000000000001;
                }
                return dat;
            }
        }

        public static long Unid_Distribucion
        {
            get
            {
                string tmp;
                long dat = 0;
                try
                {
                    tmp = ConfigurationManager.AppSettings["Unid_Distribucion"].ToString();
                    dat = long.Parse(tmp);
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    dat = 20120000000000002;
                }
                return dat;
            }
        }

        public static long Unid_CategoryRetailDistribution
        {
            get
            {
                string tmp;
                long dat = 0;
                try
                {
                    tmp = ConfigurationManager.AppSettings["Unid_CategoryRetailDistribution"].ToString();
                    dat = long.Parse(tmp);
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    dat = 20120000000000003;
                }
                return dat;
            }
        }

        public static long Unid_DesarrolloYAdmonProveedores
        {
            get
            {
                string tmp;
                long dat = 0;
                try
                {
                    tmp = ConfigurationManager.AppSettings["Unid_DesarrolloYAdmonProveedores"].ToString();
                    dat = long.Parse(tmp);
                }
                catch (Exception ex)
                {
                    tmp = "";
                }

                if (String.IsNullOrEmpty(tmp))
                {
                    dat = 20120000000000004;
                }
                return dat;
            }
        }

    }//end class
}
